package gameEntities;

import javax.microedition.lcdui.game.Sprite;
import math.*;

/**
 * The Class GameEntity is the structure for a game entity.
 */
public abstract class GameEntity {

	/**
	 * Instantiates a new game entity.
	 *
	 * @param sprite the sprite
	 * @param position the position
	 */
	public GameEntity(Sprite sprite, Vector2D position) {
		this.sprite = sprite;
		this.position = position;
		this.sprite.setPosition((int)position.x, (int)position.y); 
		this.destroyable = false;
	}
	
	/**
	 * If the game entity collides with the given game entity
	 *
	 * @param ge the other game entity
	 * @return true, if they collide
	 */
	public boolean Collides(GameEntity ge) {
		return ge.sprite.collidesWith(sprite, false);
	}
	
	/**
	 * Dates the game entity up.
	 *
	 * @param deltaTime the delta time
	 */
	public abstract void Update(float deltaTime);

	public final Sprite sprite;
	
	public final Vector2D position;
	
	public boolean destroyable;
}
